package ch14;

import junit.framework.TestCase;
import org.junit.Test;

import static org.junit.Assert.assertEquals;


/**
 * Created by 春旺 on 2017/10/9.
 */
public class ArrayStackTest{


    @Test
    public void push() throws Exception {

    }

    @Test
    public void pop() throws Exception {
        ArrayStack stack1 = new ArrayStack();
        stack1.push("3");
        assertEquals("3",stack1.pop());
        assertEquals(null,stack1.pop());

    }

    @Test
    public void peek() throws Exception {
        ArrayStack stack1 = new ArrayStack();
        stack1.push(3);
        assertEquals(3,stack1.peek());
        stack1.pop();
        assertEquals(null,stack1.peek());

    }

    @Test
    public void isEmpty() throws Exception {
        ArrayStack stack2 = new ArrayStack();



     assertEquals(true,stack2.isEmpty());
     stack2.push(2);
     assertEquals(false,stack2.isEmpty());
    }

    @Test
    public void size() throws Exception {
        ArrayStack stack1 = new ArrayStack();
        assertEquals(0,stack1.size());
        stack1.push(2);
        assertEquals(1,stack1.size());
    }



}